#include "stdafx.h"

#include "helpers.h"

int helpers::Grid::_displayList = 0;
int helpers::Cube::_displayList = 0;

helpers::Grid::Grid(){}
helpers::Grid::~Grid(){}

helpers::Cube::Cube(){}
helpers::Cube::~Cube(){}

void helpers::Grid::init()
{
	_displayList = glGenLists(1);
	glNewList(_displayList, GL_COMPILE);

	glBegin(GL_LINES);
	{
		glColor3f(0.6f, 0.6f, 0.7f);
		int i = 6;
		while(--i >= -5)
		{
			glVertex3i(i, 0, -5);
			glVertex3i(i, 0, 5);
		}
		while(++i <= 5)
		{
			glVertex3i(-5, 0, i);
			glVertex3i(5, 0, i);
		}
	}
	glEnd();
	glEndList();
}

void helpers::Cube::init()
{
	_displayList = glGenLists(1);
	glNewList(_displayList, GL_COMPILE);

	glBegin(GL_LINES);
	{
//		glColor3f(0.1f, 0.1f, 0.1f);

		glVertex3f(-0.5f,  0.5f,  0.5f);
		glVertex3f( 0.5f,  0.5f,  0.5f);
		glVertex3f( 0.5f,  0.5f,  0.5f);
		glVertex3f( 0.5f, -0.5f,  0.5f);
		glVertex3f( 0.5f, -0.5f,  0.5f);
		glVertex3f(-0.5f, -0.5f,  0.5f);
		glVertex3f(-0.5f, -0.5f,  0.5f);
		glVertex3f(-0.5f,  0.5f,  0.5f);

		glVertex3f(-0.5f,  0.5f,  0.5f);
		glVertex3f(-0.5f,  0.5f, -0.5f);
		glVertex3f( 0.5f,  0.5f,  0.5f);
		glVertex3f( 0.5f,  0.5f, -0.5f);
		glVertex3f( 0.5f, -0.5f,  0.5f);
		glVertex3f( 0.5f, -0.5f, -0.5f);
		glVertex3f(-0.5f, -0.5f,  0.5f);
		glVertex3f(-0.5f, -0.5f, -0.5f);
		
		glVertex3f(-0.5f,  0.5f, -0.5f);
		glVertex3f( 0.5f,  0.5f, -0.5f);
		glVertex3f( 0.5f,  0.5f, -0.5f);
		glVertex3f( 0.5f, -0.5f, -0.5f);
		glVertex3f( 0.5f, -0.5f, -0.5f);
		glVertex3f(-0.5f, -0.5f, -0.5f);
		glVertex3f(-0.5f, -0.5f, -0.5f);
		glVertex3f(-0.5f,  0.5f, -0.5f);
	}
	glEnd();
	glEndList();
}
